package Ctr;
import Model.Employee;
import Model.EmployeeContainer;
import java.util.ArrayList;

/**
 * 
 */
public class EmployeeCtr {

    private EmployeeContainer employeeContainer;

    /**
     * 
     * 
     */
    public EmployeeCtr()
    {
        employeeContainer = EmployeeContainer.getInstance();
    }


    /**
     *
     * @param name
     * @param address
     * @param phone
     * @param password
     * @return 
     */
    public int createEmployee(String name, String address, String phone)
    {
        Employee e = new Employee(name, address, phone);
        return employeeContainer.addEmployee(e);
    }

    /**
     * @param employeeID
     */
    public void deleteEmployee(int employeeID)
    {
        employeeContainer.deleteEmployee(employeeID);
    }

    /**
     * 
     * 
     * 
     * @return
     */
    public Employee getEmployee(int employeeID)
    {
        return employeeContainer.getEmployee(employeeID);
    }

    /**
     *
     * @param employeeID
     * @return
     */
    public String findEmployee(int employeeID)
    {
        Employee e = employeeContainer.findEmployee(employeeID);
        String outputString = "ID: " + e.getEmployeeID() + "\n" + "Name: " + e.getName() + "\n" + "Address: " + e.getAddress() + "\n" + "Trade: " + e.getTrade();
        return outputString;
    }

    /**
     *
     * @param employeeID
     * @param password
     * @param name
     * @param address
     * @param phone
     */
    public void updateEmployee(int employeeID, String name, String address, String phone)
    {
        employeeContainer.updateEmployee(employeeID, name, address, phone);
    }

    /**
     * @return
     */
    public String ListAllEmployees()
    {
        return employeeContainer.listAllEmployees();
    }

    public ArrayList<Employee> getEmployeeList()
    {
        return employeeContainer.listEmployee();
    }
}